
import os

import tornado
import tornado.httpserver
import tornado.web


class Application(tornado.web.Application):
    def __init__(self):
        parent_path = os.getcwd()
        # handlers = app_handlers
        settings = dict(
            debug=False,
        )

        tornado.web.Application.__init__(self, **settings)

    def route(self, url):
        """
        :param url: URL地址
        :return: 注册路由关系对应表的装饰器
        """

        def register(handler):
            """
            :param handler: URL对应的Handler
            :return: Handler
            """
            self.add_handlers(".*$", [(url, handler)])  # URL和Handler对应关系添加到路由表中
            return handler

        return register


app = Application()
